<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>加入联盟</title>
		<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0' />
		<link rel="stylesheet" href="css/joinAlliance.css" />
		<link rel="stylesheet" type="text/css" href="css/hehua.css" />
		<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<script src="//res.qiaomukeji.com/js/chomoo-weixin.js?v=3"></script>
		<script type="text/javascript" src="js/moduls/islogin.js"></script>
		<script src="js/moduls/alliance.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="js/adapter.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

	</head>

	<body>
		<div class="top">
			<div class="top-logo">
			</div>
			<div class="top-theme">
			</div>
			<div class="top-title">
			</div>

			<div class="top-btnBack" onclick="history.go(-1);">
			</div>
		</div>
		<div class="bottom">
			<div class="bottom-logo2">
			</div>
		</div>

		<div class="right_items">
			<div class="item rules">活动规则</div>
			<div class="item rank">排行榜</div>
		</div>

		<div class="content">

			<div class="middlePath">
				<div class="title" style="font-size: 0.36rem;height: 0.36rem;line-height: 0.36rem; color: #f7dc6a; font-weight: 800;font-family: '微软雅黑';">
					<!--<img src="img/joinAlliance.png" alt="">-->
					<span>{{teamInfos.name}}</span>
					<!--<span>联盟</span>-->
				</div>
				<div class="line">
					<img src="img/line.png" alt="">
				</div>
				<div class="midContent">
					<div class="teamInfo">
						<div class="honorVal">{{teamInfos.honor}}荣誉值</div>
						<div class="rank">排名：{{teamInfos.rownum}}</div>
						<div class="area">地区：{{teamInfos.address}}</div>
					</div>
					<div class="brief">
						<div class="captainImg"><img v-bind:src="captain.avatar"></div>
						<div class="captain">
							<span>队长</span>
							<span>{{captain.name}} </span>
							<span>{{captain.lotusNum}}荷花</span>
						</div>
						<div class="teamNum">
							<span>队员</span>
							<span>{{teamUsers.length}}</span>人
						</div>
					</div>

				</div>
				<div class="tableContent">
					<div class="innerTab">
						<div class="userItem" v-for="(user,index) in teamUsers" :key="index" v-cloak>
							<div class="userPic">
								<img :src="user.avatar" />
							</div>
							<span>{{user.name}}</span>
							<span>{{user.lotusNum? user.lotusNum+"荷花" : ""}}</span>
						</div>
					</div>

				</div>
				<div class="page">
					<!--<span>页码</span>
					<span>1</span>
					<span>2</span>
					<span>3</span>
					<span>4</span>
					<span>5</span>
					<span>6</span>-->
				</div>
				<div class="line">
					<img src="img/line.png" alt="">

				</div>

			</div>
			<div class="join">加入联盟</div>
		</div>
		<script type="text/javascript">
			function getPara(_key) {
				var reg = new RegExp("(^|&)" + _key + "=([^&]*)(&|$)");
				var r = window.location.search.substr(1).match(reg);
				if(r != null) return unescape(r[2]);
				return null;
			}
			var id = getPara("teamId") || 1;
			var t_skey = getPara("skey") || "chomoo_test_010";
			var t_inviterId = getPara("inviterId") || ""
			var app = new Vue({
				el: '.content',
				data: {
					teamInfos: {},
					teamUsers: [],
					captain: {}
				}
			})

			getTeam(id, function(_res) {
				for(var i = 0; i < _res.teamUsers.length % 12; i++) {
					var t_team = {
						"name": "",
						"lotusNum": "",
						"avatar": ""

					}
					_res.teamUsers.push(t_team)
				}
				app.teamInfos = _res.teamInfo;
				app.teamUsers = _res.teamUsers;

				for(var k = 0; k < _res.teamUsers.length; k++) {
					if(_res.teamUsers[k]["uid"] == _res.teamInfo["captain"]) {
						app.captain = _res.teamUsers[k];
						console.log(app.captain)
					}
				}
				$(".join").click(function() {
					var r = confirm("是否加入联盟")
					if(r == true) {
						joinTeam(t_skey, t_inviterId, id, function(_res) {
							location.href = "myTeam.html?teamId=" + id
						})
					}
				})
			})
			$(".rank").click(function() {
				location.href = "rank.html"
			})
		</script>
		<script src="js/joinAlliance.js" type="text/javascript" charset="utf-8"></script>
	</body>

</html>